<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
		// var a=5;
		// var b=10;
		var num1=document.getElementById("num1").value;
		var num2=document.getElementById("num2").value;
			function add() {
				cons.value=parseInt(num1)+parseInt(num2);
			}
		</script>
	</head>
	<body>
		<input type="text" name="" id="num1" value="" />
		<input type="text" name="" id="num2" value="" />
		<input type="text" name="" id="cons" value="" />
		<button onclick="add()">计算</button>
	</body>
</html>
